home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 125 / Computer Shopper CD-ROM Issue 125 (1998-07)(Dennis Publishing).iso / Business / Dazzler / DAZZLER.Z / CWidgitList.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-26  |  1.2 KB  |  99 lines

  1. import java.awt.Dimension;
  2. import java.awt.Graphics;
  3. import java.util.NoSuchElementException;
  4.  
  5. class CWidgitList extends CObList {
  6.    protected int m_nLoadCount;
  7.    protected int m_CurPos;
  8.  
  9.    int GetLoadCount() {
  10.       return this.m_nLoadCount;
  11.    }
  12.  
  13.    void Draw(Graphics var1, CRect var2) {
  14.       CWidgit var3 = this.Get(this.m_CurPos);
  15.       if (var3 != null) {
  16.          var3.Draw(var1, var2);
  17.       }
  18.  
  19.    }
  20.  
  21.    boolean Increment() {
  22.       boolean var1 = false;
  23.       CWidgit var2 = this.Get(this.m_CurPos);
  24.       if (var2 != null && var2.Increment()) {
  25.          ++this.m_CurPos;
  26.          if (this.m_CurPos >= this.m_nLoadCount) {
  27.             this.m_CurPos = 0;
  28.             var1 = true;
  29.          }
  30.       }
  31.  
  32.       return var1;
  33.    }
  34.  
  35.    CWidgit GetHead() {
  36.       return (CWidgit)((CObList)this).start();
  37.    }
  38.  
  39.    Dimension Load() {
  40.       new Dimension();
  41.       Dimension var2 = new Dimension();
  42.       CWidgit var3 = null;
  43.       boolean var4 = false;
  44.       this.m_nLoadCount = 0;
  45.  
  46.       try {
  47.          var3 = this.GetHead();
  48.       } catch (NoSuchElementException var6) {
  49.          var4 = true;
  50.       }
  51.  
  52.       while(!var4) {
  53.          Dimension var1;
  54.          if (var3 != null && (var1 = var3.Load()) != null) {
  55.             var2.width = Math.max(var2.width, var1.width / var3.m_nImageCount);
  56.             var2.height = Math.max(var2.height, var1.height);
  57.             ++this.m_nLoadCount;
  58.             this.m_CurPos = -1;
  59.          }
  60.  
  61.          try {
  62.             var3 = this.GetNext();
  63.          } catch (NoSuchElementException var5) {
  64.             var4 = true;
  65.          }
  66.       }
  67.  
  68.       return var2;
  69.    }
  70.  
  71.    CWidgit Get(int var1) {
  72.       int var2 = 0;
  73.       CWidgit var3 = null;
  74.       boolean var4 = false;
  75.  
  76.       try {
  77.          var3 = this.GetHead();
  78.       } catch (NoSuchElementException var6) {
  79.          var4 = true;
  80.       }
  81.  
  82.       while(!var4 && var2 < var1) {
  83.          ++var2;
  84.  
  85.          try {
  86.             var3 = this.GetNext();
  87.          } catch (NoSuchElementException var5) {
  88.             var4 = true;
  89.          }
  90.       }
  91.  
  92.       return var3;
  93.    }
  94.  
  95.    CWidgit GetNext() {
  96.       return (CWidgit)((CObList)this).next();
  97.    }
  98. }
  99.